package com.py.credit.clean.code;

import java.util.Map;

import org.springframework.util.CollectionUtils;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;

import com.py.credit.dao.RuleCheckingDao;

/**
 * 红黑名单交叉比对
 * @author Administrator
 *
 */
public class RedBlackCompare {
	WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext();
	private RuleCheckingDao ruleCheckingDao = context.getBean(RuleCheckingDao.class);
	
	public  boolean run(Map<String, Object> map, String extend) {
		if(String.valueOf(map.get("tableId")).equals("210115")||String.valueOf(map.get("tableId")).equals("210103")) {
    		
    			Map<String,String> data1 = ruleCheckingDao.CheckType("t_100000480022_l7l5N1T4Y1","A000001",String.valueOf(map.get("A000001")));
    			Map<String,String> data2 = ruleCheckingDao.CheckType("t_100000470024_AQjUiBpBlP","A000001",String.valueOf(map.get("A000001")));
    			Map<String,String> data3 = ruleCheckingDao.CheckType("t_1000000010048_ZdSrbj13gI","A000001",String.valueOf(map.get("A000001")));
      	      if(!CollectionUtils.isEmpty(data1)||!CollectionUtils.isEmpty(data2)||!CollectionUtils.isEmpty(data3)) {     	    	  
      	    		  return false;
      	      }
    			
    		}else if(String.valueOf(map.get("tableId")).equals("210104")||String.valueOf(map.get("tableId")).equals("210105")||String.valueOf(map.get("tableId")).equals("210114")) {
    			Map<String,String> data1 = ruleCheckingDao.CheckType("t_1000000010051_NnZ50yNEjJ","A000001",String.valueOf(map.get("A000001")));
    			Map<String,String> data2 = ruleCheckingDao.CheckType("t_100000470021_7Q4CFxTJWS","A000001",String.valueOf(map.get("A000001")));
      	      if(!CollectionUtils.isEmpty(data1)||!CollectionUtils.isEmpty(data2)) {     	    	  
      	    		  return false;
      	      }
    			
    		}else {
    			return true;	
    		
    		
	}
	return true;
}
}
